<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>批改历史 - 教育AI助手</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <style>
        .container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 20px;
        }
        .history-list {
            margin-top: 20px;
        }
        .history-item {
            background-color: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
        }
        .history-item:hover {
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .history-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }
        .history-title {
            font-size: 18px;
            font-weight: bold;
        }
        .history-meta {
            color: #666;
            font-size: 14px;
        }
        .history-content {
            margin-top: 10px;
        }
        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            text-decoration: none;
            display: inline-block;
        }
        .btn-primary {
            background-color: #4CAF50;
            color: white;
        }
        .btn-primary:hover {
            background-color: #45a049;
        }
        .pagination {
            margin-top: 20px;
            text-align: center;
        }
        .pagination a {
            padding: 8px 16px;
            text-decoration: none;
            color: #000;
            border: 1px solid #ddd;
            margin: 0 4px;
        }
        .pagination a.active {
            background-color: #4CAF50;
            color: white;
            border-color: #4CAF50;
        }
        .pagination a:hover:not(.active) {
            background-color: #f5f5f5;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>批改历史</h1>
        
        <div class="history-list">
            <div th:each="record : ${records}" class="history-item">
                <div class="history-header">
                    <div class="history-title">
                        <span th:if="${record.grade}" th:text="${record.grade + '年级'}"></span>
                        <span th:if="${record.subject}" th:text="${record.subject}"></span>
                        试卷批改
                    </div>
                    <div class="history-meta" th:text="${#temporals.format(record.createdAt, 'yyyy-MM-dd HH:mm')}"></div>
                </div>
                <div class="history-content">
                    <p th:if="${record.answerRequirements}" th:text="'要求：' + ${record.answerRequirements}"></p>
                    <a th:href="@{/exam-result/{id}(id=${record.id})}" class="btn btn-primary">查看详情</a>
                </div>
            </div>
        </div>

        <div class="pagination" th:if="${records.totalPages > 1}">
            <a th:if="${records.first}" class="disabled">&laquo;</a>
            <a th:unless="${records.first}" th:href="@{/exam-history(page=${records.number - 1})}">&laquo;</a>
            
            <span th:each="i : ${#numbers.sequence(0, records.totalPages - 1)}">
                <a th:if="${i == records.number}" class="active" th:text="${i + 1}"></a>
                <a th:unless="${i == records.number}" th:href="@{/exam-history(page=${i})}" th:text="${i + 1}"></a>
            </span>
            
            <a th:if="${records.last}" class="disabled">&raquo;</a>
            <a th:unless="${records.last}" th:href="@{/exam-history(page=${records.number + 1})}">&raquo;</a>
        </div>

        <div style="margin-top: 20px;">
            <a href="/exam-submit" class="btn btn-primary">继续批改</a>
        </div>
    </div>
</body>
</html> 